package menu;

import service.addService;
import service.deleteService;
import service.findService;
import service.updateService;

import java.sql.SQLException;
import java.text.ParseException;
import java.util.Scanner;

public class menu {
    public static void menu3() {
        Scanner scanner=new Scanner(System.in);
        String choice =scanner.nextLine();
        while (true){
            System.out.println("1.增加蔬菜信息"+"\n");
            System.out.println("2.删除蔬菜信息"+"\n");
            System.out.println("3.修改蔬菜信息"+"\n");
            System.out.println("4.查询蔬菜信息"+"\n");
            System.out.println("5.退出"+"\n");
            System.out.println("请输入操作:");

            switch (choice){
                case "1":
                    try {
                        addService.addservice();
                    } catch (SQLException e) {
                        throw new RuntimeException(e);
                    } catch (ParseException e) {
                        throw new RuntimeException(e);
                    }
                    break;
                    case "2":
                        deleteService.deleteservice();
                        break;
                case "3":
                    try {
                        updateService.updataservice();
                    } catch (SQLException e) {
                        throw new RuntimeException(e);
                    }
                    break;
                case "4":
                    try {
                        findService.findservice();
                    } catch (SQLException e) {
                        throw new RuntimeException(e);
                    }
                    break;
                case"5":
                    return ;
                default:break;
            }
        }
    }
}
